package com.ruoyi.process.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.domain.WeeklyRecipes;
import com.ruoyi.process.mapper.WeeklyRecipesMapper;
import com.ruoyi.process.service.IWeeklyRecipesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 每周食谱Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class WeeklyRecipesServiceImpl implements IWeeklyRecipesService {
    @Resource
    private WeeklyRecipesMapper weeklyRecipesMapper;

    /**
     * 查询每周食谱
     *
     * @param id 每周食谱主键
     * @return 每周食谱
     */
    @Override
    public WeeklyRecipes selectWeeklyRecipesById(Long id) {
        return weeklyRecipesMapper.selectWeeklyRecipesById(id);
    }

    /**
     * 查询每周食谱列表
     *
     * @param weeklyRecipes 每周食谱
     * @return 每周食谱
     */
    @Override
    public List<WeeklyRecipes> selectWeeklyRecipesList(WeeklyRecipes weeklyRecipes) {
        return weeklyRecipesMapper.selectWeeklyRecipesList(weeklyRecipes);
    }

    /**
     * 新增每周食谱
     *
     * @param weeklyRecipes 每周食谱
     * @return 结果
     */
    @Override
    public int insertWeeklyRecipes(WeeklyRecipes weeklyRecipes) {
        weeklyRecipes.setCreateTime(DateUtils.getNowDate());
        return weeklyRecipesMapper.insertWeeklyRecipes(weeklyRecipes);
    }

    /**
     * 修改每周食谱
     *
     * @param weeklyRecipes 每周食谱
     * @return 结果
     */
    @Override
    public int updateWeeklyRecipes(WeeklyRecipes weeklyRecipes) {
        weeklyRecipes.setUpdateTime(DateUtils.getNowDate());
        return weeklyRecipesMapper.updateWeeklyRecipes(weeklyRecipes);
    }

    /**
     * 批量删除每周食谱
     *
     * @param ids 需要删除的每周食谱主键
     * @return 结果
     */
    @Override
    public int deleteWeeklyRecipesByIds(Long[] ids) {
        return weeklyRecipesMapper.deleteWeeklyRecipesByIds(ids);
    }

    /**
     * 删除每周食谱信息
     *
     * @param id 每周食谱主键
     * @return 结果
     */
    @Override
    public int deleteWeeklyRecipesById(Long id) {
        return weeklyRecipesMapper.deleteWeeklyRecipesById(id);
    }
}
